package com.example.demo.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.example.demo.VO.CartVo;
import com.example.demo.model.Cart;
import com.example.demo.service.impl.CartServiceimpl;

import java.util.List;

public interface CartService extends IService<Cart> {
    /**
     * 添加商品到购物车
     * @param uid 用户id
     * @param pid 商品id
     */
    void addToCart(Integer uid, Integer pid) throws CartServiceimpl.InsertException, CartServiceimpl.UpdateException;

    List<CartVo> getVOByUid(Integer uid);

    Integer addNum(Integer cid, Integer uid) throws CartServiceimpl.CartNotFoundException, CartServiceimpl.AccessDeniedException, CartServiceimpl.UpdateException;

    Integer reduceNum(Integer cid,Integer uid)throws CartServiceimpl.CartNotFoundException, CartServiceimpl.AccessDeniedException, CartServiceimpl.UpdateException;

    void deleteItem(Integer cid,Integer uid) throws CartServiceimpl.UpdateException;
}
